{% extends 'base.html' %}

{% block content %}
  <h1>Your announcements</h1>
  {% for announcement in object_list %}
    <div class="card mb-3">
      <div class="card-body">
        <h5 class="card-title">{{ announcement.title }}</h5>
        <p class="card-text">{{ announcement.text|safe }}</p>
        <a href="{% url 'announcement_detail' announcement.pk %}" class="btn btn-primary">Go to announcement</a>
        {% if request.user == announcement.user %}
        <a href="{% url 'announcement_update' announcement.pk %}" class="btn btn-warning">Edit</a>
        <a href="{% url 'announcement_delete' announcement.pk %}" class="btn btn-danger">Delete</a>
        {% endif %}
      </div>
    </div>
  {% empty %}
    <p>No announcement yet.</p>
  {% endfor %}
{% endblock %}
